package com.wyman.factory.core.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * @Author 李伟民
 * @Description
 * @DateTime 2024/12/6 01:08
 */
public class FileSystemResource implements Resource{

    private String path;
    private File file;

    public FileSystemResource(String path){
        this.file = new File(path);
        this.path = path;
    }

    public FileSystemResource(File file){
        this.file = file;
        this.path = file.getPath();
    }


    public String getPath() {
        return path;
    }

    @Override
    public InputStream getInputStream() throws IOException {
        return new FileInputStream(file);
    }
}
